import { listCategory } from "@/api/system/category";

export const cityMixin = {
  data(){
    return {
      //省级字典
      provinceOptions:[],
      //市级字典
      cityOptions:[],
      //区/县字典
      areaOptions:[],
    }
  },
  created() {

  },
  methods: {
    provinceSelect(){
      listCategory({'areaLevel':'1',parentId:'10001'}).then(res=>{
        this.provinceOptions = res.data;
      })
    },
    citySelect(parentId,callback){
      listCategory({'areaLevel':'2','parentId':parentId}).then(res=>{
        this.cityOptions = res.data;
        callback(res.data)
      })
    },
    areaSelect(parentId,callback){
      listCategory({'areaLevel':'3','parentId':parentId}).then(res=>{
        this.areaOptions = res.data;
        callback(res.data)
      })
    }
  }

}
